"""
@Time ： 2022/10/31 10:22
@Auth ： 陈杰 200320501042
@E-mail : 1612845322@qq.com
"""
from abc import ABCMeta, abstractmethod


class Animal(object):
    __metaclass__ = ABCMeta

    def __init__(self, name, age, cry):
        self._name = name
        self._age = age
        self._cry = cry

    @abstractmethod
    def getInfo(self): pass


class Cat(Animal):
    def __init__(self, name, age, cry):
        Animal.__init__(self, name, age, cry)

    def getInfo(self):
        print("The cat's information is below:\n" +
              "name:" + self._name + "\nage:" +
              str(self._age) + "\ncry:" + self._cry)


class Dog(Animal):
    def __init__(self, name, age, cry):
        Animal.__init__(self, name, age, cry)

    def getInfo(self):
        print("The dog's information is below:\n" +
              "name:" + self._name + "\nage:" +
              str(self._age) + "\ncry:" + self._cry)


if __name__ == '__main__':
    list = []
    c = Cat("Tom", 2, 'miao')
    list.append(c)
    d = Dog("Hacke", 4, "wang")
    list.append(d)
    for i in range(len(list)):
        list[i].getInfo()
